#pragma once 

#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>

#define MAX 1000
#define NONE_FLUSH 1
#define LINE_FLUSH (1 << 1)
#define FULL_FLUSH (1 << 2)

typedef struct IO_FILE
{
    int fileno;
    char buffer[MAX];
    int bufferlen;
    int flag;
    int flush_method;
}MyFile;

MyFile* MyFopen(const char *path, const char *mode);
void MyFclose(MyFile*);
int MyFwrite(MyFile*, const void* str, int len);
void MyFlush(MyFile*);
